<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../css1/api.css"/>
    <link rel="stylesheet" type="text/css" href="../css1/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="../css1/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css1/auislide.css" />
    <link rel="stylesheet" type="text/css" href="../css1/style.css"/>
    <link rel="stylesheet" href="../css1/base.css">
    <link rel="stylesheet" href="../css1/zhibo.css">
    <style>
           html,body{background-color: #fff}
        .empty{ text-align: center; padding: 120px 0; }
        .bd-t::after {
  content: " ";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 1px;
  background-image: linear-gradient(0deg, transparent 50%, #d1d1d1 50%);
}
.juzhong {
	text-align: center;
}
.yuo {
	text-align:  right ;
}
    </style>
</head>
<body >
  <div id="aui-slide">
    <div id="slidebox" class="aui-slide-wrap">
    </div>
    <div class="aui-slide-page-wrap"><!--分页容器--></div>
  </div>

  <div class="gonggaozb" style="background:#a43dd9">
    <div class="list-title-l">
      <i class="iconfont icon-xitonggonggao" style="color:#fafd0a;font-size: 1rem"></i>
    </div>
    <div class="gonggaozb-r">
      <span id="gonggao" style="color:#fff;font-size: 0.65rem;padding-top:0.3rem;">会员任性看</span>
    </div>
  </div>

<!--
  <div class="br"> </div>
  <div class="gonggaozb" style="background-color:#fff">
    <div class="br"> </div>
   <table width="95%" border="0" align="center" cellpadding="0" cellspacing="5">
      <tr>
        <td width="23%" class="juzhong" style="font-size:17px">直播机构</td>
        <td width="27%" ><table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #437ef6;border-radius: 5px;text-align:center;width:100%;color:#ffffff">
          <tr>
            <td>持续增加中...</td>
          </tr>
        </table></td>
        <td width="50%" class="yuo">实时更新</td>
      </tr>
    </table>
</div>-->

  <section class="aui-grid aui-margin-b-15">
    <div class="bd-t"></div>
    <div class="wrap">
      <div class="game-page">
      <div class="aui-grid aui-margin-b-hezi" id="liveList">
        <ul  id="div_list">
        </ul>
      </div>
  </section>
</body>



<script type="直播盒子" id="template">
{{~ it.pingtai : value : index }}

    <li class="aui-col-xs-3 pt-list" onclick="openWin('{{= value. address }}','{{= value. xinimg }}','{{= value. title }}','{{= value. Number }}')" class="weui-grid js_grid">

      <div class="aui-grid aui-margin-b-hezi">
        <center><img src="{{= value. xinimg }}" alt="" class="zhiboImg" style="border-radius: 300px;" ></center>
      </div>
    <div  class="aui-tm"><img src="../image/zhibo/tm.png"/></div>
      <div class="text" style="color:#911fcd">{{= value. title }} </div>

      <div class="zb-box-b-r" style="color:#836294">在线主播:{{= value. Number }}位</div>

    </li>
{{~}}
</script>



<script type="text/x-dot-template" id="bannertpl">
  {{~ it.data : value : index }}
    <div class="aui-slide-node bg-dark" tapmode onclick="toBanner('{{= value. linkurl }}')">
        <img src="http://maLequ.cn/{{= value. picurl }}" />
    </div>
  {{~}}
</script>


<script type="text/x-dot-template" id="navcattpl">
  {{~ it.data : value : index }}
  		<div class="aui-col-xs-3 pt-list" tapmode onclick="openLive('{{= value. linkurl }}')">
          <i class="aui-iconfont"><img src="http://maLequ.cn/{{= value. picurl }}"/></i>
          <div class="aui-grid-label">{{= value. name }}</div>
        </div>

  {{~}}
</script>

<!--底部图片广告-->
<script type="text/x-dot-template" id="lrtpl">
<img id="bpic" src="http://maLequ.cn/{{=it.picurl}}" onclick="openurl('{{=it.linkurl}}')">
</script>



<!--文字广告-->
<script type="text/x-dot-template" id="wzttpl">
 <span style="color:red;font-size: 0.65rem" onclick="openurl('{{=it.linkurl}}')">{{=it.name}}</span>
</script>

<!--文字广告-->
<script type="text/x-dot-template" id="wzbtpl">
 <span style="color:red;font-size: 0.65rem" onclick="openurl('{{=it.linkurl}}')">{{=it.name}}</span>
</script>

<!--底部广告区域-->
<script type="text/x-dot-template" id="navtjtpl">
  {{~ it.data : value : index }}
  		<div class="aui-col-xs-3 pt-list" tapmode onclick="openurl('{{= value. linkurl }}')">
          <div class="myui-label">{{= value. name }}</div>
          <div class="myui-label-b">{{= value. content }}</div>
          <i class="aui-iconfont"><img src="http://maLequ.cn/{{= value. picurl }}"/></i>
        </div>
  {{~}}
</script>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/doT.js"></script>
<script type="text/javascript" src="../script/auipullrefresh.js"></script>
<script type="text/javascript" src="../script/auislide.js"></script>
<script type="text/javascript" src="../script/auilazyload.js" ></script>
<script type="text/javascript">
  var imgdz = '';

  var api_url = localStorage.getItem('api_url');
  apiready = function(){
    getBanner();
    getNav();


    api.parseTapmode();
    api.ajax({
        url: api_url+'/login1/login/imgad.html',
        method: 'get'
    },function(ret, err){
        if (ret) {
          //alert( JSON.stringify( ret ) );
          localStorage.setItem('fxpic1',ret.msg.fxpic1);
          localStorage.setItem('fxurl1',ret.msg.fxurl1);
          localStorage.setItem('fxpic2',ret.msg.fxpic2);
          localStorage.setItem('fxurl2',ret.msg.fxurl2);
          var bpic = $api.byId('bpic');

        } else {

        }
    });

    api.setRefreshHeaderInfo({
        visible: true,
        loadingImg: 'widget://image/refresh.png',
        bgColor: '#fff',
        textColor: '#333',
        textDown: '下拉刷新...',
        textUp: '松开刷新...',
        showTime: true
    }, function(ret, err){
      if (err) {
        api.toast({
            msg: '加载数据失败',
            duration: 2000,
            location: 'middle'
        });
        api.refreshHeaderLoadDone();
      }else {
        getNav();
        getBanner();
        banNer();
        api.toast({
            msg: '刷新成功',
            duration: 1000,
            location: 'middle'
        });
        api.refreshHeaderLoadDone();

      }
    });
    api.ajax({
        url: 'http://maLequ.cn/login1/login/zhibjk.html',
        method: 'get'
    },function(ret, err){
        if (ret) {
          api.hideProgress();
          pingtai(ret.msg[0].pingtai);
        } else {
          api.hideProgress();
        }
    });
  };

  function pingtai(pingtai){
    //alert(pingtai);
    var div_list = $api.byId('div_list');
    var template = $api.byId('template');
    api.ajax({
        url: pingtai,
        data:{
        }
    },function(ret, err){
        if (ret) {
          //alert( JSON.stringify( ret ) );
          var pagefn = doT.template(template.text);
          div_list.innerHTML = pagefn(ret);
          //alert( pagefn(ret));
          api.hideProgress();
        } else {
          api.hideProgress();
            //alert( JSON.stringify( err ) );
        }
    });
  }


  function imgUrl(url){
    api.openWin({
        name: 'h5',
        url: './h5.html',
        pageParam: {
            url: url
        }
    });
  }



  function playRadio(){
    api.hideProgress();
  }



  //访问轮播地址
  function toBanner(url){

    if (url == '') {

    }else {
      api.openWin({
          name: 'h5',
          url: './h5.html',
          pageParam: {
              url: url
          }
      });
    }
  }

  //菜单导航获取
  function getBanner(){
    var bannerid = $api.byId('slidebox');
    var bannertpl = $api.byId('bannertpl');

    api.ajax({
        url: api_url+'/login1/login/banben.html',
        method: 'get'
    },function(ret, err){
        if (ret) {
          localStorage.setItem('user_advert',ret.advert2);
          var advert = $api.byId('gonggao');
          advert.innerHTML = localStorage.getItem('user_advert');
            localStorage.setItem('jx_url1',ret.banben);
            localStorage.setItem('jx_url2',ret.url);
            localStorage.setItem('jx_url3',ret.url2);
            localStorage.setItem('jx_url4',ret.url3);
            localStorage.setItem('jx_url5',ret.url4);
            localStorage.setItem('jx_url6',ret.url5);
            localStorage.setItem('hburl',ret.hburl);
        } else {
            //alert( JSON.stringify( err ) );
        }
    });

    api.ajax({
        url: api_url+'/app/nav',
        method: 'get',
    },function(ret, err){
        if (ret) {
          //渲染模板
          var pagefn = doT.template(bannertpl.text);
          bannerid.innerHTML = pagefn(ret.hzbanner);
//      alert( JSON.stringify( ret.banner ) );
          banNer();

        } else {
            alert( '网络错误' );
            api.hideProgress();
        }
    });
  }


  //轮播图获取
  function getNav(){
    var navid = $api.byId('div_list_f');
    var navtpl = $api.byId('navcattpl');
	  var navtjid = $api.byId('div_list');
    var navtjtpl = $api.byId('navtjtpl');
	  var lrid = $api.byId('lrbox');
    var lrtpl = $api.byId('lrtpl');



    var wztid = $api.byId('wzbox_top');
    var wzttpl = $api.byId('wzttpl');
    var wzbid = $api.byId('wzbox_bottom');
    var wzbtpl = $api.byId('wzbtpl');
    var lrbid = $api.byId('lrbbox');
    var lrbtpl = $api.byId('lrbtpl');
    api.ajax({
        url: api_url+'/app/nav',
        method: 'get',
    },function(ret, err){
        if (ret) {
          //渲染模板



        } else {
            alert( '网络错误' );
            api.hideProgress();
        }
    });
  }


  //幻灯轮播图
  function banNer(){
    var slide = new auiSlide({
        container:document.getElementById("aui-slide"),
        // "width":300,
        "height":150,
        "speed":300,
        "pageShow":true,
        "autoPlay": 5000,
        "pageStyle":'dot',
        "loop":true,
        'dotPosition':'center',
    });
  }

  new auiLazyload({
      errorImage:'../image/error-img.jpg'
  });



  function openurl(url) {
     api.openApp({
     androidPkg : 'android.intent.action.VIEW',
     mimeType : 'text/html',
     uri : url,
     }, function(ret, err) {
      var msg = JSON.stringify(ret);
      api.openApp({
      iosUrl: url
    });
    });
 }



   function openWin(url,xinimg,title){

       api.openWin({
       name: 'bzhibo_win',
       pageParam:{
       url: url,
       xinimg:xinimg,
       title:title

       },
           url: 'bzhibo_win.html',

       });

   }

</script>
</html>
